package com.mongodb.document.geoJson;

import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.geo.GeoJson;

import java.io.Serializable;

/**
 * 包装Geometry属性
 */
@Data
@ApiModel(value = "包装Geometry属性")
public class WrappedPropertyBuilder implements Serializable {
    private static final long serialVersionUID = 8217393272124358989L;
    @ApiModelProperty(value = "(前端不传)WrappedGeometry对象id", hidden = true)
    @Transient
    private String gId;
    @ApiModelProperty(value = "（前端不传）GeoJson地理位置信息", hidden = true)
    @Transient
    private GeoJson geometry;

    @ApiModelProperty(value = "geometry的标注")
    private String name;
    @ApiModelProperty(value = "备注")
    private String remark;
    @ApiModelProperty(value = "该元素样式")
    private JSONObject style;
    @ApiModelProperty(value = "设备或产权或渠道业务数据的id")
    private String pId;
    @ApiModelProperty(value = "关联业务的大类别(1设备id,2工程信息,3用水合作组织,4灌区行政区别,5水口信息,6渠道信息,7水库信息,8倒虹吸)")
    private Integer mainType;
    @ApiModelProperty(value = "关联的数据是何种类型的业务数据(每个大类型下有不同小类型,暂不清楚具体定义,请从树形结构中获取)")
    private Integer subType;

    public WrappedPropertyBuilder addGId(String gId) {
        this.gId = gId;
        return this;
    }

    public WrappedPropertyBuilder addGeometry(GeoJson geometry) {
        this.geometry = geometry;
        return this;
    }

    public WrappedPropertyBuilder addName(String name) {
        this.name = name;
        return this;
    }

    public WrappedPropertyBuilder addRemark(String remark) {
        this.remark = remark;
        return this;
    }

    public WrappedPropertyBuilder addStyle(JSONObject style) {
        this.style = style;
        return this;
    }

    public WrappedPropertyBuilder addMainType(Integer mainType) {
        this.mainType = mainType;
        return this;
    }

    public WrappedPropertyBuilder addSubType(Integer subType) {
        this.subType = subType;
        return this;
    }


    public WrappedGeometry build() {
        WrappedGeometry wrappedGeometry = new WrappedGeometry();
        wrappedGeometry.setGId(this.getGId());
        wrappedGeometry.setGeometry(this.getGeometry());
        wrappedGeometry.setProperties(this);
        return wrappedGeometry;
    }
}
